# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=vala

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.24.0
pkgrel=2
pkgdesc="Compiler for the GObject type system (mingw-w64)"
arch=('any')
url="http://live.gnome.org/Vala"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-libxslt")
depends=("${MINGW_PACKAGE_PREFIX}-glib2")
source=(http://ftp.gnome.org/pub/gnome/sources/${_realname}/${pkgver:0:4}/${_realname}-$pkgver.tar.xz)
sha256sums=('22a37c977512c19cd29c373eaaef96cb2c994795d491106f32387f3f9d1e899c')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
}

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  "${srcdir}"/${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-vapigen
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make -j1 DESTDIR="$pkgdir" install

  mv -f ${pkgdir}${MINGW_PREFIX}/share/pkgconfig/* ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/
  rm -rf ${pkgdir}${MINGW_PREFIX}/share/pkgconfig
}
